package com.studentcontrol;

import com.dao.StudentDao;
import org.apache.struts2.interceptor.RequestAware;

import javax.naming.NamingException;
import java.sql.SQLException;
import java.util.Map;

/**
 * @author :wn
 * @program : 学生信息管理系统
 * @descript :
 * @create :2020-11-13 23:19
 */

public class DeleteAction implements RequestAware {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String delete() throws SQLException, NamingException {
        boolean deleteWether=new StudentDao().deletMethod(name);
        if(deleteWether){
            String deleteInformation="删除成功！！";
            request.put("deleteInformation",deleteInformation);
            return "success";
        }else {
            String deleteInformation="删除失败！！";
            request.put("deleteInformation",deleteInformation);
          return "error";

        }

    }
    Map<String,Object>request;
    @Override
    public void setRequest(Map<String, Object> map) {
        this.request=map;
    }
}
